package com.mojo.web.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * 用户切面
 *
 * @author <a href="mailto:sjj@jianzhimao.com">mojo</a>
 * copyright (C), 2013-2022, 广州九尾信息科技有限公司
 * @date 2022/3/3 10:56
 */
@Aspect
@Component
public class UserAspect {
    @Before("proxyAdvice()")
    public void beforeAdvice() {
        System.out.println("正常执行完成前增强。。。");
    }

    @AfterReturning("proxyAdvice()")
    public void returnAdvice() {
        System.out.println("正常执行完成后增强。。。");
    }

    @AfterThrowing("proxyAdvice()")
    public void exceptionAdvice() {
        System.out.println("异常增强。。。");
    }
    @After("proxyAdvice()")
    public void afterAdvice() {
        System.out.println("始终增强。。。");
    }

    @Around("proxyAdvice()")
    public Object aroundAdvice(ProceedingJoinPoint jp) throws Throwable {
        System.out.println("环绕前增强。。。");
        Object proceed = jp.proceed();
        System.out.println("环绕后增强。。。");
        return proceed;

    }

    @Pointcut("execution(* com.mojo.web.controller.*.*(..)))")
    public void proxyAdvice() {

    }
}
